#ifndef TREELIFESKETCH_CTERRAIN
#define TREELIFESKETCH_CTERRAIN

#include "Utilities.h"
//#include "TreeWindow.h"
#include "TreeTextureLoader.h"
#include "TreeMain.h"
#include "Geometry.h"

#ifdef _WIN32
	#include <windows.h>
	#include <GL/gl.h>
	#include <GL/glu.h>
	#include "GLUT/glut.h"
#else
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <GLUT/glut.h>
#endif

#ifndef RENDER_OPTION_DEF
#define RENDER_OPTION_DEF
typedef enum {LINE_MODE, SURFACE_MODE} RENDER_OPTION;
#endif


namespace LifeSketchTree
{
class CTerrain
{
public:
	CTerrain(void);
	~CTerrain(void);
	CTerrain(int size);
	float& height(int i, int j);
	float* normal(int i, int j);
	void init(int size);
	virtual void display3D();
	void createDemoTerrain();
	RENDER_OPTION current_render_option;

	static CRawLoader barkTexture;
	static CRawLoader grassTexture;
	static CRawLoader dirtTexture;

private:
	int size;	// size is the number of quadrilaterals
				// The number of vertices/normals is size+1
	float** _height;
	CVertexArray2D _normal;
};
}
#endif // !define(LIFESKETCH_CTERRRAIN)
